﻿using Microsoft.AspNetCore.Mvc.Filters;
using RepositoryCommon;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace APIShoppingSystem.Filter 
{
    /// <summary>
    /// 异常过滤器
    /// </summary>
    public class CustomExceptionFilterAttribute : ExceptionFilterAttribute
    {
        /// <summary>
        /// 发生异常时会进入此方法中
        /// </summary>
        /// <param name="context"></param>
        public override void OnException(ExceptionContext context)
        {
            LogHelper.Log.Error(context.Exception.Message + " , " + context.Exception.StackTrace);
        }
    }
}
